<?php
/*
 * This page is to show profile page for user.
 */
$tu = true;
include '../../include/config.php';
$profile_photo_path = 'http://' . $_SERVER['HTTP_HOST'] . '/salusme/storage/profile_photo/';
include 'all.php';
?>

<?php include '../head.php'; ?>
<title>My Account</title>

<body>
    <div id="wrapper">

        <?php include '../header_profile.php'; ?>
        <?php include '../menu_left.php'; ?>
        <?php include 'usr_menu.php'; ?>

        <div class="float_right" style="width: 210px">

        <!--        <div class="float_right top_after_menu"><a href="http://www.ndroid360.com/salus/index.php/salus_bank/gen_pdf"><img id="send_mail" src="http://www.ndroid360.com/salus/public/frontend/images/icons/send.png" title="Send Email"/></a></div>-->
            <form id="ffr" name="ffr" method="post" action="">

                <input type="hidden" id="maildata" name="maildata">
                <div class="float_right top_after_menu"><a href="<?= 'http://' . $_SERVER['HTTP_HOST'] . '/salusme/user/view/profile_print' ?>" ><img id="send_mail" src="../../include/images/send.png" title="Send Email"/></a></div>

            </form>
            <div class="float_right top_after_menu"><a><img onclick="PrintElem('#mainContent')" src="../../include/images/print.png" title="Print"/></a></div>
            <div class="float_right top_after_menu"><a href="#"><img src="../../include/images/import.png" title="Import"/></a></div>
            <div class="float_right top_after_menu"  style="width: 30px"><a href="profile_edit"><img src="../../include/images/edit_icon.png" title="Edit"/></a></div>
            <div class="float_right top_after_menu"><a href=""><img src="../../include/images/new.png" title="New"/></a></div>
        </div>

        <div class="clear"></div>
        <script>
            function valid(){
                var p1 = document.forms['psw']['pass1'].value;
                var p2 = document.forms['psw']['pass2'].value;
                if(p1=='' || p2==''){
                    alert("Fill Fields");
                    return false;
                }
            }
        </script>



        <div id="mainContent">                                       
            <hr>
            <fieldset>
                <?php if ($_GET['e'] != '') { ?>    <font color="red">Error : <b><?= $_GET['e'] ?></b></font> <?php } ?>
                <?php if ($_GET['s'] != '') { ?>    <font color="Green">Success : <b><?= $_GET['s'] ?></b></font> <?php } ?>
                <legend>Change Password</legend>
                <br>
                <form action="../acc/cng_pass.php" method="post" name="psw" onsubmit=" return valid()" >
                    <table>
                        <tr>
                            <td>Current Password :</td>
                            <td><input type="password" id="pass1" name="password1" style="height: 30px;" placeholder="Current Password" required /> </td>
                        </tr>
                        <tr>
                            <td>New Password :</td>
                            <td><input type="password" id="pass2" name="password2" style="height: 30px;" placeholder="New Password" required  /> </td>
                        </tr>
                        <tr>
                            <td></td>
                            <td><input type="submit" value="Change Password" style="width: 175px; height: 35px;" /> </td>
                        </tr>
                    </table>
                </form>
            </fieldset>




            <fieldset>
                <legend>Profile Photo</legend>
                <?php
                $p0 = mysql_query("select photo from salus_user_profile_detail where FK_fa_user_id='" . $_COOKIE['gid'] . "'") or die(mysql_error());
                while ($p1 = mysql_fetch_array($p0)) {
                    echo $photo = $p1['photo'];
                }
                ?>
                <center><img src="<?= $profile_photo_path . $photo ?>" alt="profile_photo" height="100px" width="100px" />
                    <form method="post" action="../acc/pro_photo.php" enctype="multipart/form-data" >
                        <input type="file" name="uploadedfile" required />
                        <input type="hidden" name="MAX_FILE_SIZE" value="100000000000" />
                        <input type="submit" value="Change" style="width: 100px; height: 35px; " />                    
                    </form>
                </center>
            </fieldset>

            <?php
            /*
             * Showing List of accounts
             */
            ?>


            <fieldset>
                <legend>Accounts</legend>
                <b>Your Accounts:</b><hr>
                <table border="1" style="width: 600px;" >
                    <tr>
                        <th style="width: 25px;" ></th>
                        <th style="width: 150px;">Product Name</th>                        
                        <th style="width: 150px;">Subscription Period</th>
                        <th style="width: 200px;">Amount You Paid</th>
                        <th style="width: 75px;" >Date</th>
                    </tr>
<?php
$i = 1;
$a1 = mysql_query("select * from salus_buy_product where FK_fa_user_id='" . $_COOKIE['gid'] . "'") or die(mysql_error());
while ($r1 = mysql_fetch_array($a1)) {
    ?>
                        <tr>
                            <td><?= $i ?></td>
                            <td><?php
                    if ($r1['product_id'] == '1') {
                        echo 'SalusME';
                    } elseif ($r1['product_id'] == '2') {
                        echo 'SalusBaby';
                    }
                    ?></td>
                            <td>1 Year</td>
                            <td><?= $r1['product_prize'] ?></td>
                            <td>
                                JOIN : <?= $r1['date'] ?>
                            </td>
                        </tr>
<?php $i++; } ?>
                </table>
                
            </fieldset>
        </div>

    </div><!-- wrapper over    -->
    <?php
    include '../../include/config.php';
    include '../menu_right.php';
    ?>
</body>
</html>